package com.cmwa.solution.business.product.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cmwa.solution.base.entity.Page;
import com.cmwa.solution.base.entity.SearchParam;
import com.cmwa.solution.business.product.dao.TreFeeDetailDao;
import com.cmwa.solution.business.product.entity.TreFeeDetailVo;
import com.cmwa.solution.business.product.service.TreFeeDetailService;
import com.cmwa.solution.utils.SessionUtils;

/**
 * 招商财富产品表业务实现层
 */
@Service
public class TreFeeDetailServiceImpl implements TreFeeDetailService {
	@Resource
	private TreFeeDetailDao treFeeDetailDao;

	@Override
	public List<TreFeeDetailVo> getTreFeeDetailBySubPrdCode(String prdCode) {
		return treFeeDetailDao.getTreFeeDetailBySubPrdCode(prdCode);
	}

	@Override
	public Page<TreFeeDetailVo> TreFeeDetailListPage(SearchParam param) {
		List<TreFeeDetailVo> items = treFeeDetailDao.TreFeeDetailListPage(param);
		return Page.create(items, param.getStart(), param.getLimit(), param.getTotal());
	}

	@Override
	public TreFeeDetailVo getTreFeeDetailByFeeId(String feeId) {
		return treFeeDetailDao.getTreFeeDetailByFeeId(feeId);
	}

	@Override
	public void insertTreFeeDetail(TreFeeDetailVo treFeeTypeVo) {
		String createId = SessionUtils.getEmployee().getID();
		treFeeTypeVo.setCreateId(createId);
		treFeeDetailDao.insertTreFeeDetail(treFeeTypeVo);
	}

	@Override
	public void updateTreFeeDetail(TreFeeDetailVo treFeeTypeVo) {
		String modifyId = SessionUtils.getEmployee().getID();
		treFeeTypeVo.setModifyId(modifyId);
		treFeeDetailDao.updateTreFeeDetail(treFeeTypeVo);
	}

	@Override
	public int deleteTreFeeDetail(String feeId) {
		String modifyId = SessionUtils.getEmployee().getID();
		return treFeeDetailDao.deleteTreFeeDetail(modifyId ,feeId);
	}

	@Override
	public int deleteTreFeeRate(String subPrdCode, String feeCode) {
		String modifyId = SessionUtils.getEmployee().getID();
		return treFeeDetailDao.deleteTreFeeRate(modifyId, subPrdCode, feeCode);
	}


}
